import { $axios } from '@/utils/http';

// 获取优惠券列表
export async function getAllCoupons(params?: RecordItem) {
  return $axios.request({
    url: 'http://localhost:8090/dyh/coupons/getAllCoupons',
    method: 'GET',
    params,
  });
}

// 凭借id查找优惠券
export async function selectPreById(params?: RecordItem) {
  return $axios.request({
    url: 'http://localhost:8090/dyh/coupons/selectById',
    method: 'GET',
    params,
  });
}

// 凭借name模糊查找优惠券
export async function selectPreByName(params?: RecordItem) {
  return $axios.request({
    url: 'http://localhost:8090/dyh/coupons/selectByName',
    method: 'GET',
    params,
  });
}

// 优惠券下架
export async function deleteCoupons(params?: RecordItem) {
  return $axios.request({
    url: 'http://localhost:8090/dyh/coupons/removeCoupons',
    method: 'POST',
    params,
  });
}

export async function addOneCoupons(params?: RecordItem) {
  return $axios.request({
    url: 'http://localhost:8090/dyh/coupons/addCoupons',
    method: 'POST',
    params,
  });
}
